<template>
  <view :style="themeColor">
    <view class="page" :style="{'width':`${750}rpx`}">
      <view class="flex benben-position-layout flex flex-wrap align-center forgotPasswordPage_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub forgotPasswordPage_fd0_0'>
          <view class='flex flex-wrap align-center forgotPasswordPage_fd0_0_c0' @tap.stop="handleJumpDiy"
            data-type="back" data-url="1">
            <text class='fu-iconfont2  forgotPasswordPage_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
          </view>
          <view class='flex flex-wrap align-center justify-end forgotPasswordPage_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center forgotPasswordPage_flex_1">
        <view class='flex flex-wrap align-center forgotPasswordPage_fd1_0'>
          <image class='forgotPasswordPage_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"1.png"'></image>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout forgotPasswordPage_flex_2">
        <view class='flex flex-wrap align-center forgotPasswordPage_fd2_0'>
          <image class='forgotPasswordPage_fd2_0_c0' mode="aspectFit" :src='STATIC_URL+"28.png"'></image>
          <benben-input class='flex-sub forgotPasswordPage_fd2_0_c1' type="number" :placeholder="`请输入手机号`"
            confirm-type="done" :maxlength="11" placeholder-style="color:#999;font-size:32rpx" v-model="mobile" />
        </view>
        <view class='flex flex-wrap align-center forgotPasswordPage_fd2_1'>
          <image class='forgotPasswordPage_fd2_0_c0' mode="aspectFit" :src='STATIC_URL+"29.png"'></image>
          <benben-input class='flex-sub forgotPasswordPage_fd2_0_c1' type="number" :placeholder="`请输入验证码`"
            confirm-type="done" :maxlength="4" placeholder-style="color:#999;font-size:32rpx" v-model="code" />
          <benben-send-verification-code key='1706064523763' ref="vCode1706064523763"
            class=' forgotPasswordPage_fd2_1_c2' after-text='后重新获取' before-text='获取验证码' type='2'
            :phone="mobile"></benben-send-verification-code>
        </view>
        <view class='flex flex-wrap align-center forgotPasswordPage_fd2_1'>
          <image class='forgotPasswordPage_fd2_0_c0' mode="aspectFit" :src='STATIC_URL+"30.png"'></image>
          <benben-flex-password-diy v-model="password" class-name="flex flex align-center forgotPasswordPage_fd2_2_c1"
            :placeholder="'请输入密码(6~12位字母+数字)'" :maxlength="12" :default-type='true'
            placeholder-style="color:#999;font-size:32rpx">
            <template #show>
              <text class='fu-iconfont2  forgotPasswordPage_fd2_2_c1_icon1' data-type="show">&#xE837;</text>
            </template>
            <template #hide>
              <text class='fu-iconfont2  forgotPasswordPage_fd2_2_c1_icon1' data-type="hide">&#xEBCC;</text>
            </template>
          </benben-flex-password-diy>
        </view>
        <button class='forgotPasswordPage_fd2_3' @tap.stop="forgetpswdFunc()">确定</button>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},


    data() {
      return {
        "mobile": "",
        "code": "",
        "password": ""
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {

    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //忘记密码
      async forgetpswdFunc() {
        if (!validate(this.mobile, 'require')) {
          this.$message.info('请输入手机号');
          return false;
        }
        if (!validate(this.mobile, 'phone')) {
          this.$message.info('请输入正确的手机号');
          return false;
        }
        if (!validate(this.code, 'require')) {
          this.$message.info('请输入验证码');
          return false;
        }
        if (!validate(this.code, 'captcha')) {
          this.$message.info('请输入正确的验证码');
          return false;
        }
        if (!validate(this.password, 'require')) {
          this.$message.info('请输入密码');
          return false;
        }
        if (!validate(this.password, 'password')) {
          this.$message.info('密码格式错误');
          return false;
        }
        //请求方法
        //数据验证

        let data5caeeba9866aa = await this.$api.post(global.apiUrls.post5caeeba9866aa, {
          password: this.password,
          account: this.mobile,
          code: this.code,
          account_type: 'mobile'
        });

        if (data5caeeba9866aa.data.code != 1) {
          this.$message.info(data5caeeba9866aa.data.msg);
          return
        }

        uni.navigateBack()

      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: url(image-path('2.png')) no-repeat;
    background-size: 100% auto;
  }

  .forgotPasswordPage_flex_0 {
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
  }

  .forgotPasswordPage_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .forgotPasswordPage_fd0_0_c0 {
    width: 120rpx;
  }

  .forgotPasswordPage_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .forgotPasswordPage_flex_1 {
    padding: 0rpx 0rpx 0rpx 55rpx;
  }

  .forgotPasswordPage_fd1_0_c0 {
    width: 218rpx;
    height: 218rpx;
    margin: 0rpx auto 0rpx auto;
  }

  .forgotPasswordPage_fd1_0 {
    margin: 88rpx 0rpx 24rpx 0rpx;
    width: 750rpx;
  }

  .forgotPasswordPage_flex_2 {
    padding: 0rpx 56rpx 0rpx 56rpx;
  }

  .forgotPasswordPage_fd2_3 {
    background: rgba(16, 51, 126, 1);
    border-radius: 50rpx 50rpx 50rpx 50rpx;
    font-size: 32rpx;
    color: var(--benbenFontColor3);
    width: 638rpx;
    height: 88rpx;
    line-height: 88rpx;
    margin: 104rpx 0rpx 32rpx 0rpx;
  }

  .forgotPasswordPage_fd2_2_c1_icon1 {
    width: 88rpx;
    line-height: 88rpx;
    text-align: center;
    font-size: 40rpx;
  }

  ::v-deep .forgotPasswordPage_fd2_2_c1 {
    height: 45rpx;
    width: 560rpx;
    font-size: 32rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
  }

  .forgotPasswordPage_fd2_1_c2 {
    line-height: 40rpx;
    font-size: 28rpx;
    color: rgba(252, 201, 26, 1);
    font-weight: 400;
  }

  .forgotPasswordPage_fd2_1 {
    border-bottom: 1px solid #eee;
    padding: 40rpx 0rpx 40rpx 0rpx;
  }

  .forgotPasswordPage_fd2_0_c1 {
    height: 45rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
    color: var(--benbenFontColor0);
    font-size: 32rpx;
    font-weight: 400;
    line-height: 45rpx;
  }

  .forgotPasswordPage_fd2_0_c0 {
    width: 34rpx;
    height: 34rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .forgotPasswordPage_fd2_0 {
    border-bottom: 1px solid #eee;
    padding: 40rpx 0rpx 40rpx 0rpx;
    margin: 40rpx 0rpx 0rpx 0rpx;
  }
</style>
